import { _list } from '../../common/projects'
const app = getApp()
Page({
  data: {
    id: 0
  },
  getList () {
    let type = this.data.id
    app.loading('加载中')
    _list(type).then(res => {
      wx.hideLoading()
      let list = res.data.Project_Main_list
      this.setData({
        list
      })
    }).catch(err => {
      wx.hideLoading()
      wx.showModal({
        title: '对不起',
        content: JSON.stringify(err) || '网络错误，请稍后再试',
        showCancel: false
      })
    })
  },
  onLoad (options) {
    this.data.id = options.id
    let title = this.data.id == 1 ? '租售服务' : this.data.id == 2 ? '商业服务' : ''
    wx.setNavigationBarTitle({
      title
    })
    this.getList()
  },
  onReady () {

  },
  onShow () {

  },
  onHide () {

  },
  onUnload () {

  },
  onPullDownRefresh () {

  },
  onReachBottom () {

  },
  onShareAppMessage() {
    return app.shareInfo
  }
})